package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author shian
 * @create 2019-12-26 10:05
 * @Description
 */
@Getter
public enum ModuleAppTypeEnum {
    /**
     * 模板中心应用划分
     */
    OFFICIAL_APPLICATION("enum.moduleAppType.name.official_application", "officialApplication", 1),

    INCREMENT_APPLICATION("enum.moduleAppType.name.increment_application", "incrementApplication", 2),

    THIRD_PARTY_APPLICATION("enum.moduleAppType.name.third_party_application", "thirdPartyApplication", 3),

    INCREMENT_SERVICE("enum.moduleAppType.name.increment_service", "incrementService", 4),
    ;
    private String name;

    private String alias;

    private int type;

    ModuleAppTypeEnum(String name, String alias, int type) {
        this.name = name;
        this.alias = alias;
        this.type = type;
    }

    public static String getNameByType(int type) {
        for (ModuleAppTypeEnum moduleAppTypeEnum : values()) {
            if (Objects.equals(moduleAppTypeEnum.getType(), type)) {
                return moduleAppTypeEnum.getName();
            }
        }
        return "";
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
